Creating and Configuring Web Sites
Although
some Web servers might be responsible primarily for hosting only a
single Web site, it is much more common for a single IIS server to host
many different Web services and applications. Before you learn about
how to administer IIS, it is important to understand how the different
Web server components and objects fit together.
Understanding Sites and Site Bindings
Web
sites are the top-level containers that provide access to Web content.
Every Web site must map to a physical path on the server. Generally,
this path will contain the root folder for all content that will be
available to users who access the site.
The
configuration of the Web site specifies which protocols, ports, and
other settings will be used to connect to the Web server. This
information is known collectively as a site binding.
Each site can have multiple bindings, based on the needs of the server.
The details that can be specified in a site binding include:
Type Specifies the protocol that will used to connect to the Web server. The two default options are HTTP and HTTPS.
Note: Supporting other protocols
One
of the benefits of the WAS is that it enables IIS 7.0 to create sites
that respond to protocols other than HTTP and HTTPS. For the purpose of
taking the exam , you will learn
primarily about working with the two most common Web server protocols.
When supporting distributed applications, such as those that use the
WCF, keep in mind that IIS sites can support direct TCP connections and
other methods of communications.
IP Address
The list of IPv4 or IPv6 address(es) on which the server will respond.
If the server is configured with more than one IP address, different
Web sites can be configured to respond to each. In addition to
selecting a specific IP address, administrators can also choose the
(All Unassigned) option to allow the Web site to respond to a request
on any interface that doesn’t have an explicit port and protocol
binding.
Port
Specifies the TCP port on which the server will listen and respond. The
default port for HTTP connections is port 80. Users who need to access
Web sites on alternative ports must specify the port number in their
URL. For example, the URL address http://Server1.contoso.com:5937
will attempt to connect to the Web server named Server1.contoso.com by
using the HTTP protocol on TCP port 5937. The standard range for TCP
ports is between 1 and 65535. Generally, many of the port numbers under
1024 are reserved for use by specific well-known applications, although
there is no technical reason that they cannot be used for hosting a Web
site.
Host Name
This text setting allows multiple Web sites to share the same protocol
type, IP address, and port number while still allowing users to connect
to different Web sites. The method works by interpreting the host
header information stored in an HTTP request. Site administrators can
configure their DNS settings to allow multiple domain names to point to
the same IP address. The domain name information is then used by the
Web server to determine to which Web site the user is attempting to
connect and to generate the response from the appropriate site.
It
is important to remember that the combination of site binding settings
must be unique for every Web site hosted on an installation of IIS. For
example, no two Web sites can respond using the same protocol, IP
address, port, and host name setting. Although it is possible to create
multiple sites with the same site bindings, IIS will allow only a
single one of these sites to be started at a time.
Managing the Default Web Site
Initially,
the Web Server (IIS) role includes a site called Default Web Site. The
site is configured to respond to requests, using HTTP (port 80) and
HTTPS (port 443). To view a list of the bindings, right-click the
Default Web Site in IIS Manager (see Figure 5) and select Edit Bindings. (You can also use the Bindings link in the Actions pane to open the same dialog box.)
When you launch a Web browser and connect to a URL such as http://server2.contoso.com, IIS receives the request on HTTP port 80 and returns the content from the appropriate Web site.
To add a new site binding for the Default Web Site, click the Add button in the Site Bindings dialog box. As shown in Figure 6,
you can specify the protocol type, IP address, and port information
along with an optional host name. If you attempt to add a site binding
that is already in use, you will be reminded that you must configure a
unique binding.
Adding Web Sites
Start
the process of adding a new Web site to IIS by right-clicking the Sites
container in IIS Manager and selecting Add Web Site. Figure 7 shows the options that are available for the new site.
In
addition to specifying the default protocol binding for the site, you
will need to provide the site name. This setting is simply a logical
name that will not be seen directly by users of the site. By default,
IIS Manager will create a new application pool
with the same name you provide for the Web site. You can also select an
existing application pool by clicking the Select button. You will learn
more about application pools and their purpose later in this lesson.
The
Content Directory section enables you to provide the full physical path
to the folder that will be the root of the Web site. The default root
location for IIS Web content is %SystemDrive%
\Inetpub\wwwroot. The initial files for the default Web site are
located in this folder. You should create a new folder (either within
this path or in another one) to store the content of the new Web site.
The Connect As button enables you to specify the security credentials
that will be used by IIS to access the content. The default setting is
to use Pass-Through Authentication, which means that the security
context of the requesting Web user will be used.
The
final check box enables you to specify whether you want the site to be
started immediately after you click the OK button. Again, you will be
given a warning if the Web site binding information is already in use.
(See Figure 8.)
Once
you click OK to add the Web site, it will appear within the left pane
of IIS Manager. Web sites can be started and stopped individually by
selecting them and using the commands in the Actions pane or by
right-clicking and selecting the Manage Web Site menu. Other details,
such as site bindings, can also be modified at any time. This enables
you to create, reconfigure, and stop sites individually without
affecting other sites on the same server. In addition to the basic
site-related settings, there are some configuration settings that are
defined at the site level.
Configuring Web Site Limits
Web
Site Limits settings place maximum limitations on the amount of
bandwidth and the number of connections that can be supported by the
Web site. These settings enable systems administrators to ensure that
one or more sites on the server do not use excessive network bandwidth
or consume too many resources. To configure Web site limits, select the
appropriate Web site and click the Limits command in the Actions pane. Figure 9 shows the default settings for a new Web site.
The
Limit Bandwidth Usage option (which is initially disabled) enables you
to enter the maximum number of bytes per second that the Web server
will support. If this limit is exceeded, the Web server will throttle
responses by adding a time delay.
The
Connection Limits section refers to the maximum number of user
connections that can be active on the site. Each user connection is
timed-out automatically if a new request is not received within the
specified number of seconds. (The default is 120 seconds, or two
minutes.) In addition, you can configure the maximum number of
connections allowed for the site. If this number is exceeded, users
that attempt to make a new connection will receive an error message
stating that the server is too busy to respond.
Configuring Site Logging Settings
Another
site-level setting is Logging. You can access these properties by
selecting the appropriate Web site and, in the Features View,
double-clicking Logging. Figure 10 shows the default options for logging.
The
specific options that are available will be based on which role
services were installed for the Web server. By default, each new site
is configured to store text-based log files within the %SystemDrive%\Inetpub\Logs\LogFiles
path on the local server. Each Web site will be assigned its own
folder, and each folder will contain one or more log files. You can
choose from different log file formats, but the default is the W3C
format, which is a standard that can be used to compare log information
from different Web server platforms. The Select Fields button enables
you to determine which information is stored in the log file. The
default field settings are designed to provide a good balance between
performance and useful information. Adding fields can affect Web server
performance adversely and increase log file size, so add the
information that you plan to use in alter analysis only.
On
busy Web servers, log files will grow quickly. Because the log files
are text-based, it can often be difficult to manage and analyze large
files. The Log File Rollover section enables you to specify when IIS
will create a new log file. By default, a new log file will be created
daily. You can choose a different time interval, or you can specify the
maximum size of each log file. There is also an option to use only a
single log file. Although it is possible to obtain information by
opening the log files in a text viewer such as Notepad, it is much more
common to use log analysis utilities to parse the results.